<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!--Hier fuegt man seinen Arbeitsgeber  oder Firmennamen ein und beschreibt von wann bis wann man in der Firma gearbeitet hat... -->
<%String file="./index.jsp?"+Constant.CONTENT+"="+Constant.add_school, method="get"; %>
<%@page import="db.DBMain"%>
<%RequestParser.send_action_file=file;
RequestParser.send_method=method;%>
<%@include file="town.jsp" %>
<%@page import="html.RequestParser"%>
<%@page import="db.tables.DBTypeTable"%>
<%@page import="db.tables.DBSchoolTable"%>
<script type="text/javascript"><!--

<%
Long type_id_temp=DBMain.getTypeTable().selectLong(DBTypeTable.TYPE_ID_COL,DBTypeTable.TYPE_NAME_COL,Constant.Type.SCHOOL),
	user_id=0L, cat_id=RequestParser.getLongFromParameter(request,Constant.Content.CATEGORY);//session.getAttribute(Constant.USERID);
session.setAttribute(Constant.Content.TYPE,type_id_temp);

RequestParser schoolParser=new RequestParser(request,file,method);
schoolParser.isAdmin(true);
schoolParser.setAdd(Constant.Content.ADD_SCHOOL);
schoolParser.setContent(Constant.Content.SCHOOL);
schoolParser.setSubmit(Constant.Content.SUBMIT_SCHOOL);
schoolParser.setDelete(Constant.Content.DELETE_SCHOOL);
schoolParser.setInput(new String[]{Constant.Content.INPUT_SCHOOL,Constant.Content.TOWN,Constant.Content.CATEGORY});
schoolParser.setInsert_columns(new String[]{DBSchoolTable.SCHOOL_NAME_COL,DBSchoolTable.TOWN_ID_COL,DBSchoolTable.CATEGORY_ID_COL});
schoolParser.setDisplay_columns(new String[]{DBSchoolTable.SCHOOL_ID_COL,DBSchoolTable.SCHOOL_NAME_COL,DBSchoolTable.CATEGORY_ID_COL});
schoolParser.setPk_column(DBSchoolTable.SCHOOL_ID_COL);
schoolParser.setTable(DBMain.getSchoolTable());
schoolParser.setFk_columns(new String[]{DBSchoolTable.TOWN_ID_COL,DBSchoolTable.CATEGORY_ID_COL});
schoolParser.setFk_ids(new Long[]{town_id,cat_id});
schoolParser.process();

%>
//
--></script>
<form name="<%=schoolParser.getContent() %>" action="<%=schoolParser.getSend_action_file() %>" method="<%=schoolParser.getSend_method()%>">
<%@include file="category_only.jsp" %>
	<select name="<%=schoolParser.getContent() %>" onchange="submit()">
		<%
			schoolParser.printOptionList(out);
		%>
	</select>
<% if(admin) { %>
	<input type="hidden" name="<%=Constant.Content.CATEGORY %>" value="<%=categoryParser.getPk_id() %>"/>
    <input type="hidden" name="<%=Constant.Content.COUNTRY %>" value="<%=country_id %>"/>
	<input type="hidden" name="<%=Constant.Content.TOWN %>" value="<%=town_id %>"/> 
     <input name="<%=schoolParser.getContent()%>" type="hidden" value="<%=type_id_temp %>"/>
	<input name="<%=schoolParser.getDelete() %>" value="<%=Constant.Content.DELETE %>" type="submit"/>
<% } %>
<% if(admin) { %>
	<table>
	<tr><td>Schulname</td></tr>
	<tr>
	<td><input name="<%=schoolParser.getInput()[0] %>" type="text"/></td>
	</tr></table>
    <input type="hidden" name="<%=schoolParser.getContent() %>" value="<%=schoolParser.getPk_id()%>"/>
    <input type="hidden" name="<%=Constant.Content.COUNTRY %>" value="<%=country_id %>"/>
	<input type="hidden" name="<%=Constant.Content.TOWN %>" value="<%=town_id %>"/> 
	<input name="<%=schoolParser.getSubmit() %>" type="submit"/>
	<input type="reset" name="Zur&uuml;cksetzen" value="Zur&uuml;cksetzen">
</form>
<%}%>